﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using YArchitech.LIB;
using YArchitech.Revit;
using YJKRevitCode.FormUtility;
using YJKRGeometry;
using YJKRGeometry.CalculationAnalysis;

namespace YJKOpeningDetail
{
	internal class OpeningDetailManager
	{
		public OpeningDetailManager(ExternalCommandData commandData)
		{
			this.m_uiDoc = commandData.Application.ActiveUIDocument;
			this.m_doc = this.m_uiDoc.Document;
			this.m_lstDoc = this.GetAllDocument();
		}

		public bool FunctionStart()
		{
			if (!this.SelectFloors(this.m_doc))
			{
				return false;
			}
			WallAndGridInfo wallAndGridInfo = new WallAndGridInfo();
			DimensionElementsInfo dimensionElementsInfo = new DimensionElementsInfo();
			Dictionary<XYZ, List<Curve>> dicCombineGridCurve = new Dictionary<XYZ, List<Curve>>();
			foreach (Autodesk.Revit.DB.ViewPlan viewPlan in this.m_lstCopyView)
			{
				DimElementData dimElementData = new DimElementData();
				Dictionary<XYZ, DataWall> dicWallCurve = new Dictionary<XYZ, DataWall>();
				bool wallOrGridInfo = wallAndGridInfo.GetWallOrGridInfo(this.m_doc, viewPlan, this.m_lstAllLevelValues, ref dicWallCurve, ref dicCombineGridCurve);
				if (wallOrGridInfo)
				{
					dimensionElementsInfo.GetDimensionElements(this.m_doc, viewPlan, ref dimElementData, this.m_lstAllLevelValues);
					foreach (Document doc in this.m_lstDoc)
					{
						if (dimElementData.m_dicEquip.Count > 0)
						{
							foreach (KeyValuePair<ElementInfo, int> keyValuePair in dimElementData.m_dicEquip)
							{
								int value = keyValuePair.Value;
								ElementInfo key = keyValuePair.Key;
								Wall wall = null;
								List<XYZ> lstBoxVertexes = new List<XYZ>();
								if (this.IsIntersectForBox(key, viewPlan, ref wall, ref lstBoxVertexes, doc))
								{
									this.DimBoxSimilar(value, key, wall, lstBoxVertexes, viewPlan, dicWallCurve, dicCombineGridCurve);
								}
							}
						}
						if (dimElementData.m_lstDuct.Count > 0)
						{
							foreach (ElementInfo elementInfo in dimElementData.m_lstDuct)
							{
								if (PublicFunction.IsRectangularDuct(elementInfo.element))
								{
									List<Element> lstIntersectDuctElement = new List<Element>();
									List<Element> list = new List<Element>();
									lstIntersectDuctElement.AddRange(PublicFunction.GetAllIntersectSubject<Element>(elementInfo.element, doc, BuiltInCategory.OST_Walls));
									list.AddRange(PublicFunction.GetAllIntersectSubject<Element>(elementInfo.element, doc, BuiltInCategory.OST_StructuralFraming));
									if (list != null && list.Count > 0)
									{
										list.ForEach(delegate(Element ele)
										{
											lstIntersectDuctElement.Add(ele);
										});
									}
									if (lstIntersectDuctElement.Count >= 1)
									{
										Dictionary<XYZ, Element> dicPtIntersectInfo = new Dictionary<XYZ, Element>();
										if (this.TravelAllIntersectWall(lstIntersectDuctElement, elementInfo.element, ref dicPtIntersectInfo))
										{
											this.DimDuct(elementInfo, null, viewPlan, dicWallCurve, dicCombineGridCurve, dicPtIntersectInfo);
										}
									}
								}
							}
						}
						if (dimElementData.m_lstPipe.Count > 0)
						{
							foreach (ElementInfo elementInfo2 in dimElementData.m_lstPipe)
							{
								List<Element> lstIntersectPipe = new List<Element>();
								List<Element> list2 = new List<Element>();
								lstIntersectPipe.AddRange(PublicFunction.GetAllIntersectSubject<Element>(elementInfo2.element, doc, BuiltInCategory.OST_Floors));
								list2.AddRange(PublicFunction.GetAllIntersectSubject<Element>(elementInfo2.element, doc, BuiltInCategory.OST_Roofs));
								if (list2 != null && list2.Count > 0)
								{
									list2.ForEach(delegate(Element ele)
									{
										lstIntersectPipe.Add(ele);
									});
								}
								if (lstIntersectPipe.Count >= 1)
								{
									Dictionary<XYZ, Element> dicPtIntersectInfo2 = new Dictionary<XYZ, Element>();
									if (!this.TravelAllIntersectFloor(lstIntersectPipe, elementInfo2.element, ref dicPtIntersectInfo2))
									{
										return false;
									}
									this.DimPipe(elementInfo2, viewPlan, dicWallCurve, dicCombineGridCurve, dicPtIntersectInfo2);
								}
							}
						}
						if (dimElementData.m_lstCableTray.Count > 0)
						{
							foreach (ElementInfo elementInfo3 in dimElementData.m_lstCableTray)
							{
								List<Element> list3 = new List<Element>();
								list3.AddRange(PublicFunction.GetAllIntersectSubject<Element>(elementInfo3.element, doc, BuiltInCategory.OST_Floors));
								if (list3.Count >= 1)
								{
									Dictionary<XYZ, Element> dicPtIntersectInfo3 = new Dictionary<XYZ, Element>();
									if (this.TravelAllIntersectFloor(list3, elementInfo3.element, ref dicPtIntersectInfo3))
									{
										this.DimPipe(elementInfo3, viewPlan, dicWallCurve, dicCombineGridCurve, dicPtIntersectInfo3);
									}
								}
							}
							foreach (ElementInfo elementInfo4 in dimElementData.m_lstCableTray)
							{
								List<Element> list4 = new List<Element>();
								list4.AddRange(PublicFunction.GetAllIntersectSubject<Element>(elementInfo4.element, doc, BuiltInCategory.OST_Walls));
								if (list4.Count >= 1)
								{
									Dictionary<XYZ, Element> dicPtIntersectInfo4 = new Dictionary<XYZ, Element>();
									if (this.TravelAllIntersectWall(list4, elementInfo4.element, ref dicPtIntersectInfo4))
									{
										this.DimDuct(elementInfo4, dimElementData.m_lstFloorAndBeam, viewPlan, dicWallCurve, dicCombineGridCurve, dicPtIntersectInfo4);
									}
								}
							}
						}
					}
					if (dimElementData.m_dicGap.Count > 0)
					{
						foreach (KeyValuePair<ElementInfo, int> keyValuePair2 in dimElementData.m_dicGap)
						{
							ElementInfo key2 = keyValuePair2.Key;
							int value2 = keyValuePair2.Value;
							if (value2 == 4)
							{
								if (Geometry.IsEqual(viewPlan.GenLevel.Elevation, PublicFunction.GetElementLevel(key2)))
								{
									this.DimGapSimilar(value2, key2, null, viewPlan, dicWallCurve, dicCombineGridCurve);
								}
							}
							else
							{
								this.DimGapSimilar(value2, key2, null, viewPlan, dicWallCurve, dicCombineGridCurve);
							}
						}
					}
					if (dimElementData.m_dicEquipBasePumb.Count > 0)
					{
						foreach (KeyValuePair<FamilyInstance, ElementInfo> keyValuePair3 in dimElementData.m_dicEquipBasePumb)
						{
							FamilyInstance key3 = keyValuePair3.Key;
							ElementInfo value3 = keyValuePair3.Value;
							this.DimPumbBase(key3, value3, viewPlan, dicWallCurve, dicCombineGridCurve);
						}
					}
					if (dimElementData.m_dicEquipBaseBox.Count > 0)
					{
						foreach (KeyValuePair<FamilyInstance, ElementInfo> keyValuePair4 in dimElementData.m_dicEquipBaseBox)
						{
							FamilyInstance key4 = keyValuePair4.Key;
							ElementInfo value4 = keyValuePair4.Value;
							this.DimPumbBase(key4, value4, viewPlan, dicWallCurve, dicCombineGridCurve);
						}
					}
				}
			}
			return true;
		}

		private bool CopySelectView(List<ViewPlan> selectFloors)
		{
			if (selectFloors != null && selectFloors.Count<ViewPlan>() < 1)
			{
				return false;
			}
			Transaction transaction = new Transaction(this.m_doc, "Duplicates selected views");
			string text = "";
			try
			{
				this.m_lstCopyView = new List<ViewPlan>();
				foreach (Autodesk.Revit.DB.ViewPlan viewPlan in selectFloors)
				{
					text = viewPlan.Name;
					if (text.Contains("建模"))
					{
						text = text.Replace("建模", "提资");
						text = text.Replace("平面图", "-留洞图");
					}
					else
					{
						text = "提资-" + text + "-留洞图";
					}
					FilteredElementCollector filteredElementCollector = new FilteredElementCollector(this.m_doc);
					IList<Element> list = filteredElementCollector.OfClass(typeof(ViewPlan)).OfCategory(BuiltInCategory.OST_Views).ToElements();
					foreach (Element element in list)
					{
						ViewPlan viewPlan2 = element as Autodesk.Revit.DB.ViewPlan;
						if (text.Equals(viewPlan2.Name))
						{
							if (this.m_uiDoc.ActiveView.Name.Equals(text))
							{
								this.m_uiDoc.ActiveView = (list.First<Element>() as Autodesk.Revit.DB.ViewPlan);
							}
							transaction.Start();
							this.m_doc.Delete(viewPlan2.Id);
							transaction.Commit();
						}
					}
					if (viewPlan.CanViewBeDuplicated(0))
					{
						transaction.Start();
						ElementId elementId = viewPlan.Duplicate(0);
						ViewPlan viewPlan3 = this.m_doc.GetElement(elementId) as Autodesk.Revit.DB.ViewPlan;
						Parameter parameter = viewPlan3.GetParameter(BuiltInParameter.VIEW_NAME);
						if (parameter != null && !parameter.IsReadOnly)
						{
							parameter.Set(text);
							transaction.Commit();
							if (viewPlan3 != null)
							{
								this.m_lstCopyView.Add(viewPlan3);
							}
							if (!this.m_uiDoc.ActiveView.Name.Equals(text))
							{
								this.m_uiDoc.ActiveView = viewPlan3;
							}
						}
					}
				}
			}
			catch (Exception)
			{
				transaction.RollBack();
			}
			return this.m_lstCopyView.Count >= 1;
		}

		public bool SelectFloors(Document doc)
		{
			List<Level> sortLevels = PublicFunction.GetSortLevels(doc, double.MinValue, double.MaxValue);
			this.m_lstAllLevelValues = PublicFunction.GetLevelValue(sortLevels);
			List<ViewPlan> list = new List<ViewPlan>();
			List<double> list2 = new List<double>();
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(doc).OfClass(typeof(ViewPlan));
			foreach (Element element in filteredElementCollector)
			{
				ViewPlan viewPlan = element as Autodesk.Revit.DB.ViewPlan;
                if (viewPlan != null && (int)viewPlan.ViewType == 1 && viewPlan.GenLevel != null && !viewPlan.Name.Contains("留洞图"))
				{
					list2.Add(viewPlan.GenLevel.Elevation);
					list.Add(viewPlan);
				}
			}
			List<ViewPlan> list3 = new List<ViewPlan>();
			foreach (Level level in sortLevels)
			{
				foreach (Autodesk.Revit.DB.ViewPlan viewPlan2 in list)
				{
					if (Geometry.IsEqual(level.Elevation, viewPlan2.GenLevel.Elevation))
					{
						list3.Add(viewPlan2);
					}
				}
			}
			OpeningViewFloorSelectForm viewSelForm = new OpeningViewFloorSelectForm();
			list3.ForEach(delegate(ViewPlan v)
			{
				viewSelForm.ChklSelViews.Items.Add(v.Name);
			});
			string pathName = doc.PathName;
			List<ViewPlan> list4 = new List<ViewPlan>();
			SelectFloorUtility.ReadSelectFloorsForm("CmdOpeningDetail", pathName, viewSelForm.ChklSelViews);
			if (viewSelForm.ShowDialog() == DialogResult.OK)
			{
				SelectFloorUtility.WriteSelectFloorsToFile("CmdOpeningDetail", pathName, viewSelForm.ChklSelViews);
				foreach (int index in viewSelForm.SelectedViewIndexs())
				{
					list4.Add(list3[index]);
				}
				if (!this.CopySelectView(list4))
				{
					return false;
				}
			}
			return true;
		}

		private bool TravelAllIntersectFloor(List<Element> lstIntersectPipe, Element mepElem, ref Dictionary<XYZ, Element> dicPtIntersectInfo)
		{
			try
			{
				Line mepcurveLine = PublicFunction.GetMEPCurveLine(mepElem);
				if (mepcurveLine == null)
				{
					return false;
				}
				foreach (Element elem in lstIntersectPipe)
				{
					PublicFunction.GetCvIntersect2FloorPoints(mepcurveLine, elem, ref dicPtIntersectInfo);
				}
			}
			catch (Exception)
			{
				return false;
			}
			return true;
		}

		private bool TravelAllIntersectWall(List<Element> lstIntersectDuct, Element mepElem, ref Dictionary<XYZ, Element> dicPtIntersect)
		{
			try
			{
				Line mepcurveLine = PublicFunction.GetMEPCurveLine(mepElem);
				if (mepcurveLine == null)
				{
					return false;
				}
				foreach (Element elem in lstIntersectDuct)
				{
					PublicFunction.GetCvIntersect2ElemPoints(mepcurveLine, elem, ref dicPtIntersect);
				}
			}
			catch (Exception)
			{
				return false;
			}
			return true;
		}

		private List<Document> GetAllDocument()
		{
			List<Document> list = new List<Document>();
			list.Add(this.m_doc);
			List<RevitLinkInstance> allRevitLinkInstancesInDoc = PublicFunction.GetAllRevitLinkInstancesInDoc(this.m_doc);
			if (allRevitLinkInstancesInDoc == null || allRevitLinkInstancesInDoc.Count < 1)
			{
				return list;
			}
			foreach (RevitLinkInstance revitLinkInstance in allRevitLinkInstancesInDoc)
			{
				Document linkDocument = revitLinkInstance.GetLinkDocument();
				if (linkDocument != null)
				{
					list.Add(linkDocument);
				}
			}
			return list;
		}

		public bool IsIntersectForBox(ElementInfo eleInfo, ViewPlan viewPlan, ref Wall wall, ref List<XYZ> lstBoxVertexes, Document doc)
		{
			bool result;
			try
			{
				FamilyInstance familyInstance = eleInfo.element as FamilyInstance;
				if (familyInstance == null)
				{
					result = false;
				}
				else
				{
					List<Face> lstFace = new List<Face>();
					if (!PublicFunction.GetAllFace(familyInstance, ref lstFace, XYZ.BasisZ, null))
					{
						result = false;
					}
					else
					{
						List<XYZ> list = new List<XYZ>();
						Transform transform = familyInstance.GetTransform();
						if (!PublicFunction.GetAllPoint(transform, lstFace, ref list) || list.Count == 0)
						{
							result = false;
						}
						else
						{
							list = (from pt in list
							orderby pt.Z
							select pt).ToList<XYZ>();
							List<XYZ> vertexes = new List<XYZ>();
							if (!PublicFunction.GetMirrorPoint(list, ref vertexes))
							{
								result = false;
							}
							else
							{
								List<XYZ> list2 = new List<XYZ>();
								double d = 0.0;
								double d2 = 0.0;
								if (!MinAreaBoundingBoxCalculator.MinAreaRect(vertexes, ref list2, ref d2, ref d))
								{
									result = false;
								}
								else
								{
									PublicFunction.GetGreater(d, d2, ref d2, ref d);
									double num = 0.0;
									double num2 = 0.0;
									PublicFunction.GetGreater(list2[2].X, list2[0].X, ref num, ref num2);
									double num3 = 0.0;
									double num4 = 0.0;
									PublicFunction.GetGreater(list2[2].Y, list2[0].Y, ref num3, ref num4);
									XYZ xyz = new XYZ(num, num3, list[0].Z);
									XYZ xyz2 = new XYZ(num2, num4, list[list.Count - 1].Z);
									if (eleInfo.revitLink != null)
									{
										Transform transform2 = eleInfo.revitLink.GetTransform();
										using (List<XYZ>.Enumerator enumerator = list2.GetEnumerator())
										{
											while (enumerator.MoveNext())
											{
												XYZ xyz3 = enumerator.Current;
												transform2.OfPoint(xyz3);
												lstBoxVertexes.Add(xyz3);
											}
											goto IL_1E2;
										}
									}
									lstBoxVertexes = list2;
									IL_1E2:
									Outline outline = null;
									try
									{
										outline = new Outline(xyz, xyz2);
									}
									catch (Exception)
									{
										return false;
									}
									if (outline.IsEmpty)
									{
										result = false;
									}
									else
									{
										FilteredElementCollector filteredElementCollector = new FilteredElementCollector(doc);
										BoundingBoxIntersectsFilter boundingBoxIntersectsFilter = new BoundingBoxIntersectsFilter(outline);
										List<Wall> list3 = filteredElementCollector.OfClass(typeof(Wall)).WherePasses(boundingBoxIntersectsFilter).Cast<Wall>().ToList<Wall>();
										if (list3 == null || list3.Count < 1)
										{
											result = false;
										}
										else
										{
											wall = list3[0];
											Outline outline2 = null;
											BoundingBoxXYZ boundingBoxXYZ = wall.get_BoundingBox(viewPlan);
											XYZ xyz4 = new XYZ(boundingBoxXYZ.Min.X, boundingBoxXYZ.Min.Y, boundingBoxXYZ.Min.Z + NumbericTools.mmToFeet(1.0));
											XYZ xyz5 = new XYZ(boundingBoxXYZ.Max.X, boundingBoxXYZ.Max.Y, boundingBoxXYZ.Max.Z - NumbericTools.mmToFeet(1.0));
											try
											{
												outline2 = new Outline(xyz4, xyz5);
											}
											catch (Exception)
											{
												return false;
											}
											if (outline2.IsEmpty)
											{
												result = false;
											}
											else
											{
												FilteredElementCollector filteredElementCollector2 = new FilteredElementCollector(doc);
												BoundingBoxIntersectsFilter boundingBoxIntersectsFilter2 = new BoundingBoxIntersectsFilter(outline2);
												List<Wall> list4 = filteredElementCollector2.OfClass(typeof(Wall)).WherePasses(boundingBoxIntersectsFilter2).Cast<Wall>().ToList<Wall>();
												if (list4 == null || list4.Count < 2)
												{
													result = false;
												}
												else
												{
													result = true;
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
			catch (Exception)
			{
				result = false;
			}
			return result;
		}

		public bool IsIntersectForrectangular(ElementInfo eleInfo, ref List<XYZ> lstBoxVertexes)
		{
			bool result;
			try
			{
				FamilyInstance familyInstance = eleInfo.element as FamilyInstance;
				if (familyInstance == null)
				{
					result = false;
				}
				else
				{
					List<Face> lstFace = new List<Face>();
					if (!PublicFunction.GetAllFace(familyInstance, ref lstFace, XYZ.BasisZ, null))
					{
						result = false;
					}
					else
					{
						List<XYZ> list = new List<XYZ>();
						Transform transform = familyInstance.GetTransform();
						if (!PublicFunction.GetAllPoint(transform, lstFace, ref list) || list.Count == 0)
						{
							result = false;
						}
						else
						{
							list = (from pt in list
							orderby pt.Z
							select pt).ToList<XYZ>();
							List<XYZ> vertexes = new List<XYZ>();
							if (!PublicFunction.GetMirrorPoint(list, ref vertexes))
							{
								result = false;
							}
							else
							{
								List<XYZ> list2 = new List<XYZ>();
								double num = 0.0;
								double num2 = 0.0;
								if (!MinAreaBoundingBoxCalculator.MinAreaRect(vertexes, ref list2, ref num2, ref num))
								{
									result = false;
								}
								else
								{
									if (eleInfo.revitLink != null)
									{
										Transform transform2 = eleInfo.revitLink.GetTransform();
										using (List<XYZ>.Enumerator enumerator = lstBoxVertexes.GetEnumerator())
										{
											while (enumerator.MoveNext())
											{
												XYZ xyz = enumerator.Current;
												transform2.OfPoint(xyz);
												lstBoxVertexes.Add(xyz);
											}
											goto IL_129;
										}
									}
									lstBoxVertexes = list2;
									IL_129:
									result = true;
								}
							}
						}
					}
				}
			}
			catch (Exception)
			{
				result = false;
			}
			return result;
		}

		private void DimBoxSimilar(int iBoxCategory, ElementInfo elementInfo, Wall wall, List<XYZ> lstBoxVertexes, ViewPlan viewPlan, Dictionary<XYZ, DataWall> dicWallCurve, Dictionary<XYZ, List<Curve>> dicCombineGridCurve)
		{
			BoundaryBasedRectComponent boundaryBasedRectComponent = new BoundaryBasedRectComponent();
			switch (iBoxCategory)
			{
			case 0:
				boundaryBasedRectComponent.DimBoxFunction(elementInfo, wall, lstBoxVertexes, viewPlan, dicWallCurve, dicCombineGridCurve, this.m_doc, iBoxCategory);
				return;
			case 1:
				boundaryBasedRectComponent.DimBoxFunction(elementInfo, wall, lstBoxVertexes, viewPlan, dicWallCurve, dicCombineGridCurve, this.m_doc, iBoxCategory);
				return;
			case 2:
				boundaryBasedRectComponent.DimBoxFunction(elementInfo, wall, lstBoxVertexes, viewPlan, dicWallCurve, dicCombineGridCurve, this.m_doc, iBoxCategory);
				return;
			case 3:
				boundaryBasedRectComponent.DimBoxFunction(elementInfo, wall, lstBoxVertexes, viewPlan, dicWallCurve, dicCombineGridCurve, this.m_doc, iBoxCategory);
				return;
			case 4:
				boundaryBasedRectComponent.DimBoxFunction(elementInfo, wall, lstBoxVertexes, viewPlan, dicWallCurve, dicCombineGridCurve, this.m_doc, iBoxCategory);
				return;
			case 5:
				boundaryBasedRectComponent.DimBoxFunction(elementInfo, wall, lstBoxVertexes, viewPlan, dicWallCurve, dicCombineGridCurve, this.m_doc, iBoxCategory);
				return;
			default:
				return;
			}
		}

		private bool DimGapSimilar(int iCategory, ElementInfo elementInfo, FamilyInstance famiPumb, ViewPlan viewPlan, Dictionary<XYZ, DataWall> dicWallCurve, Dictionary<XYZ, List<Curve>> dicCombineGridCurve)
		{
			switch (iCategory)
			{
			case 0:
			{
				CompoundComponent compoundComponent = new CompoundComponent();
				compoundComponent.DimGapFunction(elementInfo, viewPlan, dicWallCurve, dicCombineGridCurve, this.m_doc);
				break;
			}
			case 3:
			{
				CenterBasedCircularComponent centerBasedCircularComponent = new CenterBasedCircularComponent();
				centerBasedCircularComponent.DimBoxFunction(elementInfo, viewPlan, dicWallCurve, dicCombineGridCurve, this.m_doc, iCategory);
				break;
			}
			case 4:
				if (PublicFunction.IsRectangularWaterCollection(elementInfo.element as FamilyInstance))
				{
					CenterBasedCircularComponent centerBasedCircularComponent2 = new CenterBasedCircularComponent();
					centerBasedCircularComponent2.DimBoxFunction(elementInfo, viewPlan, dicWallCurve, dicCombineGridCurve, this.m_doc, iCategory);
				}
				else
				{
					List<XYZ> lstBoxVertexes = new List<XYZ>();
					this.IsIntersectForrectangular(elementInfo, ref lstBoxVertexes);
					CenterBasedRectComponent centerBasedRectComponent = new CenterBasedRectComponent();
					centerBasedRectComponent.DimRectangularFunction(elementInfo, null, lstBoxVertexes, viewPlan, dicWallCurve, dicCombineGridCurve, this.m_lstDoc, 4);
				}
				break;
			case 5:
			{
				PointBasedComponent pointBasedComponent = new PointBasedComponent();
				pointBasedComponent.DimBoxFunction(elementInfo, viewPlan, null, null, this.m_doc, iCategory);
				break;
			}
			}
			return true;
		}

		private void DimDuct(ElementInfo elementInfo, List<ElementInfo> lstFloorAndBeamInfo, ViewPlan viewPlan, Dictionary<XYZ, DataWall> dicWallCurve, Dictionary<XYZ, List<Curve>> dicCombineGridCurve, Dictionary<XYZ, Element> dicPtIntersectInfo)
		{
			LinearBasedComponent linearBasedComponent = new LinearBasedComponent();
			foreach (KeyValuePair<XYZ, Element> keyValuePair in dicPtIntersectInfo)
			{
				linearBasedComponent.DimDuctFunction(elementInfo, lstFloorAndBeamInfo, viewPlan, dicWallCurve, this.m_lstAllLevelValues, dicCombineGridCurve, keyValuePair.Key, keyValuePair.Value, this.m_doc);
			}
		}

		private void DimPipe(ElementInfo elementInfo, ViewPlan viewPlan, Dictionary<XYZ, DataWall> dicWallCurve, Dictionary<XYZ, List<Curve>> dicCombineGridCurve, Dictionary<XYZ, Element> dicPtIntersectInfo)
		{
			CircularComponent circularComponent = new CircularComponent();
			foreach (KeyValuePair<XYZ, Element> keyValuePair in dicPtIntersectInfo)
			{
				circularComponent.DimBoxFunction(elementInfo, viewPlan, dicWallCurve, dicCombineGridCurve, this.m_doc, keyValuePair.Key, keyValuePair.Value);
			}
		}

		private void DimPumbBase(FamilyInstance famiPumb, ElementInfo elementInfo, ViewPlan viewPlan, Dictionary<XYZ, DataWall> dicWallCurve, Dictionary<XYZ, List<Curve>> dicCombineGridCurve)
		{
			List<XYZ> lstBoxVertexes = new List<XYZ>();
			this.IsIntersectForrectangular(elementInfo, ref lstBoxVertexes);
			CenterBasedRectComponent centerBasedRectComponent = new CenterBasedRectComponent();
			centerBasedRectComponent.DimRectangularFunction(elementInfo, famiPumb, lstBoxVertexes, viewPlan, dicWallCurve, dicCombineGridCurve, this.m_lstDoc, 0);
		}

		private List<double> m_lstAllLevelValues;

		private List<Level> m_lstAllLevels = new List<Level>();

		private List<ViewPlan> m_lstCopyView;

		private Document m_doc;

		private UIDocument m_uiDoc;

		public List<Document> m_lstDoc;
	}
}
